# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudAsset.V1.Model.GoogleCloudAssetV1Rule do
  @moduledoc """
  This rule message is a customized version of the one defined in the Organization Policy system. In addition to the fields defined in the original organization policy, it contains additional field(s) under specific circumstances to support analysis results.

  ## Attributes

  *   `allowAll` (*type:* `boolean()`, *default:* `nil`) - Setting this to true means that all values are allowed. This field can be set only in Policies for list constraints.
  *   `condition` (*type:* `GoogleApi.CloudAsset.V1.Model.Expr.t`, *default:* `nil`) - The evaluating condition for this rule.
  *   `conditionEvaluation` (*type:* `GoogleApi.CloudAsset.V1.Model.ConditionEvaluation.t`, *default:* `nil`) - The condition evaluation result for this rule. Only populated if it meets all the following criteria: * There is a condition defined for this rule. * This rule is within AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy, or AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy when the AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset has AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource.
  *   `denyAll` (*type:* `boolean()`, *default:* `nil`) - Setting this to true means that all values are denied. This field can be set only in Policies for list constraints.
  *   `enforce` (*type:* `boolean()`, *default:* `nil`) - If `true`, then the `Policy` is enforced. If `false`, then any configuration is acceptable. This field can be set only in Policies for boolean constraints.
  *   `values` (*type:* `GoogleApi.CloudAsset.V1.Model.GoogleCloudAssetV1StringValues.t`, *default:* `nil`) - List of values to be used for this policy rule. This field can be set only in policies for list constraints.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allowAll => boolean() | nil,
          :condition => GoogleApi.CloudAsset.V1.Model.Expr.t() | nil,
          :conditionEvaluation => GoogleApi.CloudAsset.V1.Model.ConditionEvaluation.t() | nil,
          :denyAll => boolean() | nil,
          :enforce => boolean() | nil,
          :values => GoogleApi.CloudAsset.V1.Model.GoogleCloudAssetV1StringValues.t() | nil
        }

  field(:allowAll)
  field(:condition, as: GoogleApi.CloudAsset.V1.Model.Expr)
  field(:conditionEvaluation, as: GoogleApi.CloudAsset.V1.Model.ConditionEvaluation)
  field(:denyAll)
  field(:enforce)
  field(:values, as: GoogleApi.CloudAsset.V1.Model.GoogleCloudAssetV1StringValues)
end

defimpl Poison.Decoder, for: GoogleApi.CloudAsset.V1.Model.GoogleCloudAssetV1Rule do
  def decode(value, options) do
    GoogleApi.CloudAsset.V1.Model.GoogleCloudAssetV1Rule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudAsset.V1.Model.GoogleCloudAssetV1Rule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
